<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/page/base.jsp"%>
<%@ taglib prefix="d" uri="/doone-comm-ui-tags"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>"></base>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title></title>
		<!-- Libraries -->
		<link type="text/css" href="<%=path%>/manage/css/layout.css" rel="stylesheet" />
		<link type="text/css" href="<%=path%>/manage/css/new_style.css" rel="stylesheet" />
		<script type="text/javascript"
			src="<%=path%>/manage/js/jquery-1.4.4.min.js"></script>
		<script type="text/javascript"
			src="<%=path%>/manage/js/easyTooltip.js"></script>
		<script type="text/javascript"
			src="<%=path%>/manage/js/jquery-ui-1.8.11.custom.min.js"></script>
		<script type="text/javascript"
			src="<%=path%>/manage/js/jquery.wysiwyg.js"></script>
		<script type="text/javascript"
			src="<%=path%>/manage/js/hoverIntent.js"></script>
		<script type="text/javascript" src="<%=path%>/manage/js/superfish.js"></script>
		<script type="text/javascript" src="<%=path%>/manage/js/custom.js"></script>
		<script type="text/javascript"
			src="<%=path%>/manage/js/My97DatePicker/WdatePicker.js"></script>
		<sx:head />
		<script language="javascript" type="text/javascript">
function openShare(shareid) {
	    //应用编辑
			$.ajax({
				url : root+'/share/getShare.action',
				method : 'post',
				dataType : 'json',
				data:{'intShare' : shareid},
				success : function(data) {
				      $("#varShareContent").attr("value",data.varShareContent);
				      $("#varContentName").attr("value",data.varContentName);
				      $("#datShareDaetime").attr("value",data.datShareDaetime);
				      $("#varTypeName").attr("value",data.varTypeName);
				      $("#varUserName").attr("value",data.varUserName);
					  $("#openFavoritesDialog").dialog("open");
				},
				error:function(err){
					if(err.responseText!='')
						alert(err.responseText);
					else
						alert("请求失败！");
				}
			});
			
		
	}
	
	
	
$(document).ready(function() {

		//加载消息编辑dialog
		$("#openFavoritesDialog").dialog({
			autoOpen : false,
			width : 420,
			height :350,
			modal : true,
			title : '分享详情',
			buttons : {
				"关闭" : function() {
					$(this).dialog("close");
			}
			},
			close : function() {
				$("#openFavoritesform")[0].reset();
			}
        
	});
	});
//删除分享
	function delShare(intShare) {
	if (confirm("慎重考虑是否确定删除该记录?删除后无法查看该条记录！！！")) {	  	  
			$.ajax({
				url : root+'/share/delShare.action',
				method : 'post',				
				data:{'intShare' : intShare},
				success : function(data) {
				  alert("删除成功");
				  window.location.href=root+'/share/getSharePage.action';
				},
				error:function(err){
					if(err.responseText!='')
						alert(err.responseText);
					else
						alert("请求失败！");
				}
			});
			}
}

	
	
</script>

	</head>

	<body>

		<div>
			<p class="sitemap">
				当前位置：内容管理 > 分享管理
			</p>
			<h1>
				分享管理
			</h1>
			<div>

				<!-- Tabs -->
				<div id="tabs">
					<ul>
						<li>
							<a href="#tabs-1">分享内容列表</a>
						</li>

					</ul>
					<form name="searchForm" id="searchForm" method="post"
						action="<%=path%>/share/getSharePage.action" style="margin:10px 0;">
						内容标题:
						<s:textfield name="condition.varContentName"></s:textfield>
						类型：
						<s:select name="condition.intShareType" list="#request.typeTabList"
							listKey="key" listValue="value" headerKey=""
							headerValue="—请选择—" />
						<input type="submit" id="searchBtn" value="检索">
					</form>
					<!-- First tab -->
					<table cellspacing="0" cellpadding="0" border="0" class="fullwidth">
						<thead>
							<tr>
								<td width="150px;">
									用户名
								</td>
								<td>
									内容标题
								</td>
								<td>
									分享时间
								</td>
								<td>
									类型
								</td>
								<td>
									操作
								</td>
							</tr>
						</thead>
						<tbody>
							<s:iterator value="shareList">
								<tr class="odd">
									<td>
										<s:property value="varUserName" />
									</td>
									<td>
										<s:property value="varContentName" />
									</td>
									<td>
										<s:property value="datShareDaetime" />
									</td>
									<td>
										<s:property value="varTypeName" />
									</td>
									<td>
										<a class="icon icon_detail" title="详情 " href="javascript:openShare('<s:property value="intShare" />')"></a>
										<a class="icon icon_delete" title="删除 " href="javascript:delShare('<s:property value="intShare" />')"></a>
									</td>
								</tr>
							</s:iterator>

						</tbody>
					</table>
					<!-- End of Tabs -->
				</div>
				<!-- 分页标签开始 -->
				<div align="right" style="float: right;">
					<d:page id="page" template="details" skin="gray">
					</d:page>
				</div>
				<!-- 分页标签结束 -->
				<hr />
			</div>
		</div>




		<!-- 编辑页使用的弹出层 -->
		<div id="openFavoritesDialog" style="display: none;">
			<form id="openFavoritesform">
				<table class="fullwidth" cellpadding="0" cellspacing="0" border="0">
					<tr>
						<td>
							分享人
						</td>
						<td>
							<input type="text" id="varUserName" readonly="readonly">
						</td>
					</tr>
					<tr>
						<td>
							分享内容名称
						</td>
						<td>
							<input type="text" id="varContentName" readonly="readonly">
						</td>
					</tr>

					<tr>
						<td>
							内容简介
						</td>
						<td>
							<input type="text" id="varShareContent" readonly="readonly">
						</td>
					</tr>
					<tr>
						<td>
							类型
						</td>
						<td>
							<input type="text" id="varTypeName" readonly="readonly">
						</td>
					</tr>
					<tr>
						<td>
							分享时间
						</td>
						<td>
							<input type="text" id="datShareDaetime" readonly="readonly">
						</td>
					</tr>
				</table>
			</form>
		</div>

	</body>
</html>
